package com.tac.controller;

import com.tac.common.R;
import com.tac.pojo.Student;
import com.tac.service.StudentService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    @GetMapping("/selectAll")
    public R selectAll(){
        List<Student> students = studentService.selectAll();
        return R.success(students,"查询成功");
    }

    /**
     * 删除学生
     * @param sid
     * @return
     */
    @DeleteMapping("/delete")
    public R delete(Integer sid){
        R r = studentService.delete(sid);
        return r;
    }
}
